package com.erpanderp.wam.tm.view;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

import com.erpanderp.wam.tm.model.entity.RecruitmentRequest;
import com.erpanderp.wam.tm.model.service.RRFDAO;
import com.erpanderp.wam.usm.model.entity.user.WAMUser;
import com.erpanderp.wam.util.CommonLookup;

@ManagedBean
@ViewScoped
public class RRFReportExportBean implements Serializable{

	private static final long serialVersionUID = 1L;
	private HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
	private WAMUser wamUser = (WAMUser) session.getAttribute(CommonLookup.SESSION_ATTRIBUTE_WAMUSER);	

	private List<RecruitmentRequest> recruitmentRequestList = new ArrayList<RecruitmentRequest>();
	
	private RRFDAO rrfDAO = new RRFDAO();
	
	int sno=1;
	
	public RRFReportExportBean() {
		
		if (wamUser != null) {
			setRecruitmentRequestList(rrfDAO.getAllRRFs());			
			for(RecruitmentRequest recruitmentRequest : recruitmentRequestList){
				recruitmentRequest.setsNo(sno);
				sno++;
			}			
			
		}else{
			System.out.println("WAM USER NULL=======");
		}
		
	}

	//SETTERS AND GETTERS
	public WAMUser getWamUser() {
		return wamUser;
	}

	public void setWamUser(WAMUser wamUser) {
		this.wamUser = wamUser;
	}

	public List<RecruitmentRequest> getRecruitmentRequestList() {
		return recruitmentRequestList;
	}

	public void setRecruitmentRequestList(List<RecruitmentRequest> recruitmentRequestList) {
		this.recruitmentRequestList = recruitmentRequestList;
	}

}
